package com.zero.storage.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zero.storage.entity.StorageEntity;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

/**
 * @author zero
 * @ClassName StorageMapper
 * @Description
 * @Date 2025/5/15 13:37
 */
public interface StorageMapper extends BaseMapper<StorageEntity> {
    @Update("update storage_tbl set count = count - ${count} where commodity_code = #{commodityCode}")
    int deduct(@Param("commodityCode") String commodityCode, @Param("count") int count);

    @Update("update storage_tbl set count = count + ${count} where commodity_code = #{commodityCode}")
    int refund(@Param("commodityCode") String commodityCode, @Param("count") int count);
}
